package cn.cpf.app.gobang.ctrl;

import cn.cpf.app.gobang.frame.GoBangPanel;
import cn.cpf.app.gobang.frame.GobangFrame;
import cn.cpf.app.gobang.modal.Part;
import cn.cpf.app.gobang.modal.PlayerType;

import java.awt.*;

/**
 * <b>Description : </b> 应用启动类
 * <p>
 * <b>created in </b> 2021/8/28
 * </p>
 *
 * @author CPF
 * @since 1.0
 **/
public class Application {

    private static AppConfig appConfig;

    public static AppConfig config() {
        return appConfig;
    }

    private static AppContext appContext;

    public static AppContext context() {
        return appContext;
    }

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(() -> {
            try {
                appConfig = new AppConfig();
                appConfig.setFirstPart(Part.BLACK);
                appConfig.setBlackPlayerType(PlayerType.MAN);
                appConfig.setWhitePlayerType(PlayerType.COM);
                appConfig.setComIntervalTime(500);
                appConfig.setSearchDeepLevel(6);
                appConfig.setSearchKillStepDeepLevel(0);
                appConfig.setParallel(true);
                GobangFrame frame = new GobangFrame();
                frame.setVisible(true);
                // 获取配置棋子
                final GoBangPanel goBangPanel = frame.getGoBangPanel();
//                Situation situation = new Situation(list, new SituationRecord(), Application.config().getFirstPart(), LocalDateTime.now());
                appContext = new AppContext(goBangPanel);
//                appContext.init(situation);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
    }

}
